import {request} from './request'

// 获取购物车列表
export function getCart(data = '') {
	return request({
		url: '/api/carts?' + data,
		method: 'GET',
	})
}


// 添加购物车
export function addCart(data) {
	return request({
		url: '/api/carts',
		method: 'POST',
		data
	})
}

// 修改购物车
export function modifyCart(id, data) {
	return request({
		url: `/api/carts/${id}`,
		method: 'PUT',
		data
	})
}

// 删除购物车
export function deleteCartItem(id) {
	return request({
		url: `/api/carts/${id}`,
		method: 'DELETE',
	})
}

// 选择商品状态
export function checkedCart(data) {
	return request({
		url: '/api/carts/checked',
		method: 'PATCH',
		data
	})
}

